package com.gzu.live.service.impl;
import com.gzu.live.mapper.LiveMapper;
import com.gzu.live.pojo.Live;
import com.gzu.live.service.LiveService;
import com.gzu.live.utils.UploadImgUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Service
public class LiveServiceImpl implements LiveService {
    @Autowired
    private LiveMapper liveMapper;
    @Override
    public void addLive(Live live) {

        liveMapper.addLive(live);
    }


    @Override
    public List<Live> findLiveList() {

        return liveMapper.findLiveList();
    }

    @Override
    public void updateLiveById(int userId) {

         liveMapper.updateLiveById(userId);
    }

    @Override
    public void deleteById(int userId) {
        liveMapper.deleteById(userId);
    }

   //上传图片
    @Override
    public String uploadCover(MultipartFile file) {
        String url= UploadImgUtil.uploadImage(file);
        return url;//返回图片url
    }
}
